#encoding=utf-8

from cPAMIE import PAMIE
import time
import win32api
import win32con
import win32gui

class Phtml:
    def __init__(self,url='about:blank',timeOut=300):
        #self.ie=PAMIE()
        #self.ie.navigate(url)
        self.name = 'roi'

    def openFull(self,url='about:blank'):
        ie._wait()
        self.ie.navigate(url)
        t0=time.time()
        while not ie.findText('W_moredown'): #return True
            ie._wait()
            win32api.keybd_event(35,0,0,0)
            print 'opening'

    def debug(self):
        #ie.ClickButton(unicode('下一页', 'cp936'))
        #while win32gui.GetForegroundWindow()==win32gui.FindWindow('IEFrame',None):
        #t=ie.outerHTML()
        print self.name

class Pdebug:
    def debug(self):
        dbg = Phtml()
        dbg.debug()

'''<div node-type="feed_list_page" class="W_pages">
      <a action-type="feed_list_page_pre" action-data="page=1" href="http://weibo.com/mooncakeguan?page=1" class="W_btn_c"><span>上一页</span></a>
      <span class="list">
       <div action-type="feed_list_page_morelist" class="W_pages_layer S-FIXED" style="display: none">
       <a action-type="feed_list_page_more" action-data="currentPage=2&amp;countPage=22" href="javascript:void(0)" class="W_moredown"><span class="txt">第&nbsp;2&nbsp;页</span><em class="W_arrow"><em class="down">◆</em></em></a>
   </span>
      <a action-data="page=3" action-type="feed_list_page_next" href="http://weibo.com/mooncakeguan?page=3" class="W_btn_c"><span>下一页</span></a>
   </div>
http://weibo.com/mooncakeguan?sudaref=weibo.com&page=2&pre_page=1&end_id=3536110099543934&end_msign=-1
http://weibo.com/mooncakeguan?sudaref=weibo.com&page=11&pre_page=2&end_id=3536110099543934&max_msign=-1
'''
if __name__=='__main__':
    ph = Pdebug()
    ph.debug()
